]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
BluetoothStatus: hide the icon when no adapter is present
authorGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 30 Dec 2010 14:34:42 +0000 (15:34 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 6 Jan 2011 18:54:28 +0000 (19:54 +0100)
There is no point in showing the bluetooth status, when the required
hardware is missing. Just hide in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=638306

js/ui/status/bluetooth.js

index 7a6206d11a2f1e42172898d0ddef953898672f9d..06e16e4b30d841d3608ca817dcbb3f43ffd454d0 100644 (file)
@@ -104,12 +104,18 @@ Indicator.prototype = {
     _updateKillswitch: function() {
         let current_state = this._applet.killswitch_state;
         let on = current_state == GnomeBluetoothApplet.KillswitchState.UNBLOCKED;
+        let has_adapter = current_state != GnomeBluetoothApplet.KillswitchState.NO_ADAPTER;
         let can_toggle = current_state != GnomeBluetoothApplet.KillswitchState.NO_ADAPTER &&
                          current_state != GnomeBluetoothApplet.KillswitchState.HARD_BLOCKED;
 
         this._killswitch.setToggleState(on);
         this._killswitch.actor.reactive = can_toggle;
 
+        if (has_adapter)
+            this.actor.show();
+        else
+            this.actor.hide();
+
         if (on) {
             this._discoverable.actor.show();
             this.setIcon('bluetooth-active');
@@ -130,7 +136,7 @@ Indicator.prototype = {
         let devices = this._applet.get_devices();
 
         for (let i = 0; i < this._deviceItems.length; i++) {
-            let item = this._deviceItems.length;
+            let item = this._deviceItems[i];
             let destroy = true;
             for (let j = 0; j < devices.length; j++) {
                 // we need to deep compare because BluetoothSimpleDevice is a boxed type